<% include '/WEB-INF/includes/header.gtpl' %>


<div id="container">
<div id="container-inner">

<h1>engade unha entidade</h1>

<form id="formulario" method="POST" action="/entidade">
<input type="hidden" name="action" value="create" />
       
       
<fieldset>
<p>datos entidade</p>

<div class="campo">
<label class="etiqueta" for="nome">nome</label>
<input type="text" id="nome" name="nome"/>
<span class="mensaje"></span>
</div>


<div class="campo">
<label class="etiqueta" for="tipo">Tipo</label>
<% include '/WEB-INF/groovy/listaTiposEntidade.groovy' %>
<span class="mensaje"></span>
</div>



  <div class="controls">
  
       
      <!--<a href="/" id="cancel" class="submit" name="cancel">Cancela</a>-->      
      <input id="submit" class="submit" name="submit" type="submit" 
          value="Crea entidade"/>
      
          
    </div>
    

</fieldset>

</form>
</div>
</div>


<% include '/WEB-INF/includes/footer-sinlateral.gtpl' %>


<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-i18n.js" type="text/javascript"></script>


<script type="text/javascript">
jQuery(function() {

	
    var validator = jQuery("#formulario").validate({
        rules: {
            nome: {
              required:true,	
              maxlength:250
            }
        },
        messages: {
        	nome: {
       	        	   required:"Este campo e requirido",
            	   maxlength:"Non podes pasar dos 250 caracteres"
            }
        },
        // the errorPlacement has to take the table layout into account
        errorPlacement: function(error, element) {
            if ( element.is(":radio") )
                error.appendTo( element.parent().next().next() );
            else if ( element.is(":checkbox") )
                error.appendTo ( element.next() );
            else
                //error.appendTo( element.parent().next() );
                error.appendTo( element.next());
        },
        
        // set this class to error-labels to indicate valid fields
        success: function(label) {
            // set &nbsp; as text for IE
            label.html("&nbsp;").addClass("checked");
        }
    });
    
}); 
    
    
</script>   



<% include '/WEB-INF/includes/fin.gtpl' %>

